import request from '@/utils/request'
import md5 from 'js-md5'

export function login(data) {
  data.password = md5(data.password + 'ysu课设')
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}
export function register(data) {
  data.password = md5(data.password + 'ysu课设')
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}
export function exists(data) {
  return request({
    url: '/user/findByuat',
    method: 'post',
    data
  })
}

export function resetpwd(data) {
  data.password = md5(data.password + 'ysu课设')
  return request({
    url: '/user/resetpassword',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
export function verifyCode(data) {
  return request({
    url: '/enterprise/verifycode',
    method: 'post',
    data: { invite_code: data }
  })
}
